package com.yztc.yidoutang.activity.darenshow_activity;

import com.yztc.yidoutang.bean.DaRenShowBean;
import com.yztc.yidoutang.http.DaRenShowService;
import com.yztc.yidoutang.http.HttpHelper;

import java.util.Map;

import retrofit2.Retrofit;
import rx.Observable;
import rx.Observer;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;

/**
 * Created by My on 2016/10/19.
 */

public class DaRenShowModel implements DaRenShowContract.Model {
    @Override
    public void getDaRenData(Map<String, String> params, final DaRenShowContract.OnLoadDaRenShowListener loadDaRenShowListener) {
        Retrofit retrofit= HttpHelper.getInstance().getRetrofit();
        Observable<DaRenShowBean> observable=retrofit.create(DaRenShowService.class).getDaRenShowList(params);
        observable.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer<DaRenShowBean>() {
            @Override
            public void onCompleted() {

            }

            @Override
            public void onError(Throwable e) {

            }

            @Override
            public void onNext(DaRenShowBean daRenShowBean) {
                loadDaRenShowListener.onSuccess(daRenShowBean);
            }
        });
    }
}
